home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / GETTEXT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  914 b   |  41 lines

  1. /* p877.c --- bible */
  2. #include <alloc.h>
  3. #include <conio.h>
  4. char text[] = "Testing gettext/puttext. Press any key to go on.";
  5. main()
  6. {
  7.     int i, left = 20, right = 60, top = 10, bottom = 20, bufsize;
  8.     char *tbuffer;
  9.     for(i = 1; i <= 25; i++)
  10.     {
  11.         gotoxy(1, i);
  12.         cputs(text);
  13.     }
  14. getch();
  15.     bufsize = 2 * (bottom - top + 1) * (right - left + 1);
  16.     if((tbuffer = (char *)malloc(bufsize)) == NULL)
  17.     {
  18.         cputs("Error allocating buffer");
  19.         exit(1);
  20.     }
  21.     if(!gettext(left, top, right, bottom, tbuffer))
  22.     {
  23.         cputs("Error saving text!");
  24.         exit(1);
  25.     }
  26.     getch();
  27.     window(left, top, right, bottom);
  28.     textbackground(RED);
  29.     clrscr();
  30. getch();
  31.     textcolor(YELLOW);
  32.     gotoxy(2, 4);
  33. getch();
  34.     cputs("Pop-up Menu is easy in Turbo C.");
  35.     gotoxy(2, 10);
  36.     cputs("Press a key to exit menu: ");
  37.     getch();
  38.     if(!puttext(left, top, right, bottom, tbuffer))
  39.         cputs("Error restoring text!");
  40. getch();
  41. }